<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<nav class="navbar navbar-default" th:fragment="nav">
    <div class="container-fluid">
        <!-- Brand and toggle get grouped for better mobile display -->
        <div class="navbar-header">
            <button aria-expanded="false" class="navbar-toggle collapsed" data-target="#bs-example-navbar-collapse-1"
                    data-toggle="collapse" type="button">
                <span class="sr-only">青芸社区</span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
            </button>
            <a class="navbar-brand" href="/">青芸社区</a>
        </div>

        <!-- Collect the nav links, forms, and other content for toggling -->
        <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
            <form class="navbar-form navbar-left">
                <div class="form-group">
                    <input class="form-control" placeholder="搜索问题" type="text">
                </div>
                <button class="btn btn-default" type="submit">搜索</button>
            </form>
            <ul class="nav navbar-nav navbar-right" th:if="${session.user !=null}">
                <li>
                    <a href="/publish/turnTo/" class="glyphicon glyphicon-plus">提问</a>
                </li>
                <li style="margin-left: 50px"><img class="sm_img img-thumbnail"  th:src="${session.user.avatarUrl}"></li>
                <li class="dropdown">
                    <a aria-expanded="false" aria-haspopup="true" class="dropdown-toggle" data-toggle="dropdown"
                       href="#" role="button">
                        <span th:text="${session.user.getName()}"></span>
                        <span class="caret"></span></a>
                    <ul class="dropdown-menu">
                        <li><a href="/profile/question">我的问题</a></li>
                        <li><a href="#">个人资料</a></li>
                        <li class="divider" role="separator"></li>
                        <li><a href="/logout">退出</a></li>
                    </ul>
                </li>
            </ul>
            <ul class="nav navbar-nav navbar-right" th:if="${session.user ==null}">
                <li><a
                        href="https://github.com/login/oauth/authorize?client_id=7184bc9de0f791a3c0d2&redirect_uri=http://localhost:8882/callback&scope=user&state=1">登录</a>
                </li>
            </ul>
        </div><!-- /.navbar-collapse -->
    </div><!-- /.container-fluid -->
</nav>
</html>